package com.yanqu.road.server.cmd.activity.mammonhall;

import com.yanqu.road.pb.activity.MammonHallProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.mammonhall.MammonHallMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;
import com.yanqu.road.server.protocol.Protocol;

import java.util.ArrayList;
import java.util.List;

@Cmd(code = GameProtocol.S_MAMMON_HALL_RANK_LIST, desc = "财神殿-榜单")
public class MammonHallRankListCmd extends AbstractCommand {

    List<Integer> typeList = new ArrayList<>();

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        MammonHallProto.MammonHallRankListReqMsg reqMsg = MammonHallProto.MammonHallRankListReqMsg.parseFrom(packet.getBytes());
        typeList = reqMsg.getTypeList();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        //上分组跨服取值
        MammonHallProto.MammonHallRankListReqMsg.Builder reqMsg = MammonHallProto.MammonHallRankListReqMsg.newBuilder();
        reqMsg.addAllType(typeList);
        reqMsg.setNum(MammonHallMgr.MAMMON_HALL_RANK_NUM);
        player.sendPacket(Protocol.C_MAMMON_HALL_RANK_LIST, reqMsg);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
